package com.xinruke.hostels.reservation.controller;

import com.xinruke.hostels.common.controller.BaseController;
import com.xinruke.hostels.common.vo.ResultVO;
import com.xinruke.hostels.common.vo.query.RowsDataVO;
import com.xinruke.hostels.dailymanage.interfaces.dto.*;
import com.xinruke.hostels.reservation.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author GuoZheng
 * @ClassName ReservationCommentController
 * @date：2019/6/23
 * @version: 1.0
 * @description：评论管理
 */
@RestController
@RequestMapping("/comment/")
@Api(tags = "评论管理")
public class CommentController extends BaseController {
    @Resource
    private CommentService commentService;

    /**
     * 提交商品评价信息
     *
     * @return
     */
    @PostMapping("/submit")
    @ApiOperation("提交评论")
    public ResultVO<String> submit(@Valid @RequestBody CommentSubmitInfoDto params) {
        return commentService.submit(params);
    }

    /**
     * 得到订单的评价信息
     */
    @PostMapping("/detail")
    @ApiOperation("评论详情")
    public ResultVO<CommentDetailQueryResultDTO> detail(@Valid @RequestBody CommentDetailQueryDTO params) {
        return commentService.detail(params);
    }

    /**
     * 评论列表
     *
     * @param
     * @return
     */
    @PostMapping("/list")
    @ApiOperation(value = "评论列表")
    public ResultVO<RowsDataVO<CommentInfoQueryResultDTO>> list(@RequestBody @Valid CommentInfoQueryDto commentInfoQueryDto) {
        return commentService.list(commentInfoQueryDto);
    }

}
